#include "EntityManager.hpp"
#include "Entity.hpp"

namespace lua
{

EntityManager::EntityManager() : 
	mEntities()
{

}

void EntityManager::add(Entity *entity)
{
	mEntities.push_back(entity);
}

void EntityManager::remove(Entity *entity)
{
	for(std::vector<Entity*>::iterator it = mEntities.begin(); it != mEntities.end(); ++it)
	{
		if(*it = entity)
		{
			delete *it;
			mEntities.erase(it);
			break;
		}
	}
}

EntityManager::~EntityManager()
{
	for(std::vector<Entity*>::iterator it = mEntities.begin(); it != mEntities.end();)
	{
		delete *it;
		it = mEntities.erase(it);
	}
}

}